import { Input, Space } from 'antd';
import React, { Component } from 'react';
import '../../../assets/css/Car/gjss.css'
import axios from '../../../utils/axios'

const { Search } = Input;
const onSearch = (value) => {
    console.log(value)
    axios({
        url: "/car/useCarPage/findUseCarByUser",
        method: "get",
        params: {
            car_user: value,
            current_page: 1,
            page_size: 5
        }
    }).then((res) => {
        console.log(res);
    }).then((err) => {
        console.log(err);
    })
}
const myssvaluearr = {
    car_model: '',
    car_id: "",
    car_Status: "",
    return_time: "",
    car_location: '',
    car_user: ''
}
const getssvalue = (e) => {
    console.log(e.target.name + e.target.value);
    console.log(myssvaluearr);
    myssvaluearr[e.target.name] = e.target.value;
}
const ssqingqiu = () => {
    console.log(myssvaluearr);
    axios({
        url: "/car/carPage/findCarByAll",
        method: "get",
        params: {
            car_model: myssvaluearr.car_model,
            car_id: myssvaluearr.car_id,
            car_Status: myssvaluearr.car_Status,
            return_time: myssvaluearr.return_time,
            car_location: myssvaluearr.car_location,
            car_user: myssvaluearr.car_user,
            current_page: 1,
            page_size: 10
        }
    }).then((res) => {
        console.log(res);
    }).then((err) => {
        console.log(err);
    })
}
class Gjss extends Component {
    constructor(props) {
        super(props);
        this.state = {
            display: true,
        }
        this.showbox = this.showbox.bind(this)

    }
    // 高级搜索点击显示影藏
    showbox() {
        console.log(123);
        if (this.state.display) {
            this.setState({
                display: false
            })
        } else {
            this.setState({
                display: true
            })
        }
    }

    render() {

        return (
            <>
                <div className='gjssbox'>
                    <Space direction="vertical" className='ss' name='car_user'>
                        <Search className='srk'  onSearch={onSearch} enterButton />
                    </Space>
                    <button onClick={this.showbox}>高级搜索</button>
                </div>
                <div >

                    <form className={this.state.display ? "showbox2" : "showbox"} >
                        <div className='tbox'>
                            <span>车辆型号: </span>
                            <input type={"text"} onChange={getssvalue} name='car_model'></input>
                            <span>车辆号牌: </span>
                            <input type={"text"} onChange={getssvalue} name='car_id'></input>
                            <span>用车状态: </span>
                            <select onChange={getssvalue} name='car_Status' >
                                <option name='0'>请选择</option>
                                <option name='使用中'>使用中</option>
                                <option name='闲置'>闲置</option>
                            </select>
                        </div>
                        <div className='bbox'>
                            <span>归还时间: </span>
                            <input type='date' onChange={getssvalue} name='return_time'></input>
                            <span >使用部门: </span>
                            <select onChange={getssvalue} name='car_location'>
                                <option name='0'>请选择</option>
                                <option name='总经办'>总经办</option>
                                <option name='财务部'>财务部</option>
                                <option name='业务一部'>业务一部</option>
                                <option name='业务二部'>业务二部</option>
                                <option name='渠道招商部'>渠道招商部</option>
                                <option name='营销部'>营销部</option>
                                <option name='采购部'>采购部</option>
                                <option name='客服部'>客服部</option>
                            </select>
                            <span className='yongcheren'>用车人: </span>
                            <select onChange={getssvalue} name='car_user'>
                                <option name='0'>请选择</option>
                                <option name='张三'>张三</option>
                                <option name='老四'>李四</option>
                            </select>
                            <div className='boxbbttnn'>
                                <span className='btn121' onClick={ssqingqiu}>确定</span>
                                <span className='btn131'>清除</span>
                            </div>
                        </div>

                    </form>
                </div>


            </>
        );
    }
}

export default Gjss;
